﻿@model JinfuyuanProject.Entity.Models.MParturient
@{
    ViewBag.Title = "Revisit";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<div style="padding: 16px">

    <div class="layui-card" style="height: 800px;">
        <div class="layui-card-body">
            <h3>产妇回访</h3>
            <table class="layui-hide" id="test" lay-filter="test"></table>
        </div>


        <form class="layui-form" action="" style="margin-left: 80px;margin-right: 80px;" lay-filter="user">
            <div class="layui-form-item" style="display: flex;flex-wrap: wrap;">
                <label class="layui-form-label">回访内容</label>
                <div class="layui-input-block">
                    <textarea name="SaleContent" placeholder="请输入内容" class="layui-textarea" style="width:600px;height:200px"></textarea>
                </div>
            </div>
            <div class="layui-form-item" style="display: flex;flex-wrap: wrap;">
                <label class="layui-form-label">产妇反馈</label>
                <div class="layui-input-block">
                    <textarea name="PtContent" placeholder="请输入内容" class="layui-textarea" style="width:600px;height:200px"></textarea>
                </div>
            </div>
            <input type="hidden" id="hfname" value="@ViewBag.ParturientName" />
            <div class="layui-form-item">
                <div class="layui-input-block">
                    <button type="submit" class="layui-btn" lay-submit="" lay-filter="q">立即提交</button>
                    <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                </div>
            </div>
            <div class="wrapper wrapper-content">
                <div class="row animated fadeInRight">
                    <div class="col-sm-12">
                        <div class="ibox float-e-margins">
                            <div class="ibox-title">
                                <h5>回访记录</h5>

                            </div>
                         
                            @if (Model.Revisits == null)
                            {
                                <div class="ibox-content timeline">
                                    <div class="timeline-item">
                                        <div class="row">
                                            <div class="col-xs-3 date">
                                                <i class="fa fa-comments"></i>  <strong>暂无回访记录</strong>
                                                <br>
                                                <small class="text-navy">讨论</small>
                                            </div>
                                            <div class="col-xs-7 content">
                                                <p class="m-b-xs">
                                                    暂无回访记录
                                                </p>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            }
                            else
                            {
                                foreach (var item in Model.Revisits)
                                {
                                    <div class="ibox-content timeline">
                                        <div class="timeline-item">
                                            <div class="row">
                                                <div class="col-xs-3 date">
                                                    <i class="fa fa-comments"></i>  <strong>@item.RevisitTime</strong>
                                                    <br>
                                                    <small class="text-navy">回访详情</small>
                                                </div>
                                                <div class="col-xs-7 content">
                                                    <p class="m-b-xs">
                                                        回访内容
                                                    </p>
                                                    <p>
                                                        <strong>@item.SaleContent</strong>
                                                    </p>
                                                    <p class="m-b-xs">
                                                        产妇反馈
                                                    </p>
                                                    <p>
                                                        <strong>@item.PtContent</strong>
                                                    </p>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                }
                            }
                        </div>
                    </div>
                </div>
            </div>
        </form>
            </div>
    </div>
<script>
    var form;
    var util;
    window.onload = function () {
        layui.use(['form', 'util', 'laydate', 'upload'], function () {
            form = layui.form;
            var layer = layui.layer;
            util = layui.util;
            var laydate = layui.laydate;
            var upload = layui.upload;
            var $ = layui.jquery;
            $('#hfname').val('@ViewBag.ParturientName');
            //监听提交
            form.on('submit(q)', function (data) {
                //添加
                add(data);
                return false;
            });
        });
    }

    //添加
            function add(data) {
        debugger
        $.get("/Parturient/Back?name=" + $('#hfname').val(), { data: JSON.stringify(data.field) }, function (resp) {
            if (resp.code == 0) {
                var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                parent.layer.close(index);
                parent.layui.table.reload('testpa');
            }
        });
    }
</script>

